#ifndef _GPT_CFG_H
#define _GPT_CFG_H
/*=========================== INCLUDES ================================*/
/*common configurations*/
#include "common_cfg.h"
/* MCU registers and definitions*/
#include __MCU_DERIVATIVE
#include "typedefs.h"
#include "mcu.h"
/*=========================== TYPEDEFS ================================*/
typedef uint32_t Gpt_ChannelType;

typedef uint32_t Gpt_ValueType;

typedef uint32_t Gpt_NumChannelsType;

typedef uint32_t Gpt_TargeFrequencyType;

typedef enum {
	NOTIFICATION_DISABLE,
	NOTIFICATION_ENABLE,
}Gpt_ChannelNotification;

typedef enum {
	MICROTIMER_0,
	MICROTIMER_1,
}Gpt_MicrotimerSelectType;

typedef struct{
	Gpt_ChannelType Channel_ID;
	Gpt_TargeFrequencyType 	target_frequency;
	Gpt_ChannelNotification notification_status;
	tCallbackFunction Channel_Callback;
	Gpt_MicrotimerSelectType microtimer_select;
}Gpt_ChannelConfigType;

typedef struct
{
	Gpt_ChannelType Channel_ID;
}Gpt_ChannelConfigTimType;
typedef struct{
	Gpt_NumChannelsType NumChannels_pit;
	Gpt_NumChannelsType NumChannels_tim;
	const Gpt_ChannelConfigType * ChannelConfigs_pit;
	Gpt_ChannelConfigTimType * ChannelConfigs_tim;
}Gpt_ConfigType;
/*=========================== DEFINES =================================*/
#define CNF_MICROTIMER_PERIOD0 24000000 
#define CNF_MICROTIMER_PERIOD1 200000

#define GPT_PIT_CHANNEL_0 0u
#define GPT_PIT_CHANNEL_1 1u
#define GPT_PIT_CHANNEL_2 2u
#define GPT_PIT_CHANNEL_3 3u
#define GPT_PIT_CHANNEL_4 4u
#define GPT_PIT_CHANNEL_5 5u
#define GPT_PIT_CHANNEL_6 6u
#define GPT_PIT_CHANNEL_7 7u

#define GPT_0_CHANNELS 0u
#define GPT_1_CHANNELS 1u
#define GPT_2_CHANNELS 2u
#define GPT_3_CHANNELS 3u
#define GPT_4_CHANNELS 4u
#define GPT_5_CHANNELS 5u
#define GPT_6_CHANNELS 6u
#define GPT_7_CHANNELS 7u
#define GPT_8_CHANNELS 8u

/*============================ MACROS =================================*/
#define CNF_GPT_MICROTIMER_DIV0	(uint8_t)(( (MCAL_Mcu_BusFrequency ) / CNF_MICROTIMER_PERIOD0)-1)
#define CNF_GPT_MICROTIMER_DIV1	(uint8_t)(( (MCAL_Mcu_BusFrequency ) / CNF_MICROTIMER_PERIOD1)-1)
/*============================ EXTERNS ================================*/
extern const Gpt_ConfigType Gpt_Config;
/*========================== FUNCTIONS ================================*/

#endif /*_GPT_CFG_H*/